$(document).ready(function() {
	
	// SEF URL
	$("#title_1").keyup(function(){
		var value = $(this).val();
		convertToSlug(value);
	});
	$("#sef_url").keyup(function(){
		var value = $(this).val();
		convertToSlug(value);
	});
	
	function convertToSlug(value){
		value = value
		.toLowerCase()
		.replace(/^\s+|\s+$/g, "")
		.replace(/[_|\s]+/g, "-")
		.replace(/[^a-z\u0400-\u04FF0-9-]+/g, "")
		.replace(/[-]+/g, "-")
		.replace(/^-+|-+$/g, "")
		.replace(/ +/g,'-')
		;
	
		$("#sef_url").val(value);
	
	}
});